#pragma once
// MESSAGE XAP_ARUCO PACKING

#define MAVLINK_MSG_ID_XAP_ARUCO 20101


typedef struct __mavlink_xap_aruco_t {
 uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/
 float x; /*<   Marker pos x. */
 float y; /*<   Marker pos y. */
 float z; /*<   Marker pos z. */
 float q0; /*<   Marker attitude quaternion q0. */
 float q1; /*<   Marker attitude quaternion q1. */
 float q2; /*<   Marker attitude quaternion q2. */
 float q3; /*<   Marker attitude quaternion q3. */
 uint8_t markerID; /*<   Decode marker ID. */
 uint8_t isTarget; /*<   The sign of target. */
} mavlink_xap_aruco_t;

#define MAVLINK_MSG_ID_XAP_ARUCO_LEN 34
#define MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN 34
#define MAVLINK_MSG_ID_20101_LEN 34
#define MAVLINK_MSG_ID_20101_MIN_LEN 34

#define MAVLINK_MSG_ID_XAP_ARUCO_CRC 22
#define MAVLINK_MSG_ID_20101_CRC 22



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_XAP_ARUCO { \
    20101, \
    "XAP_ARUCO", \
    10, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_xap_aruco_t, time_boot_ms) }, \
         { "markerID", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_xap_aruco_t, markerID) }, \
         { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_xap_aruco_t, x) }, \
         { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_xap_aruco_t, y) }, \
         { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_xap_aruco_t, z) }, \
         { "q0", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_xap_aruco_t, q0) }, \
         { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_xap_aruco_t, q1) }, \
         { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_xap_aruco_t, q2) }, \
         { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_xap_aruco_t, q3) }, \
         { "isTarget", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_xap_aruco_t, isTarget) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_XAP_ARUCO { \
    "XAP_ARUCO", \
    10, \
    {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_xap_aruco_t, time_boot_ms) }, \
         { "markerID", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_xap_aruco_t, markerID) }, \
         { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_xap_aruco_t, x) }, \
         { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_xap_aruco_t, y) }, \
         { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_xap_aruco_t, z) }, \
         { "q0", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_xap_aruco_t, q0) }, \
         { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_xap_aruco_t, q1) }, \
         { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_xap_aruco_t, q2) }, \
         { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_xap_aruco_t, q3) }, \
         { "isTarget", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_xap_aruco_t, isTarget) }, \
         } \
}
#endif

/**
 * @brief Pack a xap_aruco message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param markerID   Decode marker ID. 
 * @param x   Marker pos x. 
 * @param y   Marker pos y. 
 * @param z   Marker pos z. 
 * @param q0   Marker attitude quaternion q0. 
 * @param q1   Marker attitude quaternion q1. 
 * @param q2   Marker attitude quaternion q2. 
 * @param q3   Marker attitude quaternion q3. 
 * @param isTarget   The sign of target. 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_aruco_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint32_t time_boot_ms, uint8_t markerID, float x, float y, float z, float q0, float q1, float q2, float q3, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_ARUCO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_float(buf, 4, x);
    _mav_put_float(buf, 8, y);
    _mav_put_float(buf, 12, z);
    _mav_put_float(buf, 16, q0);
    _mav_put_float(buf, 20, q1);
    _mav_put_float(buf, 24, q2);
    _mav_put_float(buf, 28, q3);
    _mav_put_uint8_t(buf, 32, markerID);
    _mav_put_uint8_t(buf, 33, isTarget);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_ARUCO_LEN);
#else
    mavlink_xap_aruco_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x = x;
    packet.y = y;
    packet.z = z;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.markerID = markerID;
    packet.isTarget = isTarget;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_ARUCO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_ARUCO;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
}

/**
 * @brief Pack a xap_aruco message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param markerID   Decode marker ID. 
 * @param x   Marker pos x. 
 * @param y   Marker pos y. 
 * @param z   Marker pos z. 
 * @param q0   Marker attitude quaternion q0. 
 * @param q1   Marker attitude quaternion q1. 
 * @param q2   Marker attitude quaternion q2. 
 * @param q3   Marker attitude quaternion q3. 
 * @param isTarget   The sign of target. 
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_xap_aruco_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint32_t time_boot_ms,uint8_t markerID,float x,float y,float z,float q0,float q1,float q2,float q3,uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_ARUCO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_float(buf, 4, x);
    _mav_put_float(buf, 8, y);
    _mav_put_float(buf, 12, z);
    _mav_put_float(buf, 16, q0);
    _mav_put_float(buf, 20, q1);
    _mav_put_float(buf, 24, q2);
    _mav_put_float(buf, 28, q3);
    _mav_put_uint8_t(buf, 32, markerID);
    _mav_put_uint8_t(buf, 33, isTarget);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XAP_ARUCO_LEN);
#else
    mavlink_xap_aruco_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x = x;
    packet.y = y;
    packet.z = z;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.markerID = markerID;
    packet.isTarget = isTarget;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XAP_ARUCO_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_XAP_ARUCO;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
}

/**
 * @brief Encode a xap_aruco struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param xap_aruco C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_aruco_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_xap_aruco_t* xap_aruco)
{
    return mavlink_msg_xap_aruco_pack(system_id, component_id, msg, xap_aruco->time_boot_ms, xap_aruco->markerID, xap_aruco->x, xap_aruco->y, xap_aruco->z, xap_aruco->q0, xap_aruco->q1, xap_aruco->q2, xap_aruco->q3, xap_aruco->isTarget);
}

/**
 * @brief Encode a xap_aruco struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param xap_aruco C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_xap_aruco_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_xap_aruco_t* xap_aruco)
{
    return mavlink_msg_xap_aruco_pack_chan(system_id, component_id, chan, msg, xap_aruco->time_boot_ms, xap_aruco->markerID, xap_aruco->x, xap_aruco->y, xap_aruco->z, xap_aruco->q0, xap_aruco->q1, xap_aruco->q2, xap_aruco->q3, xap_aruco->isTarget);
}

/**
 * @brief Send a xap_aruco message
 * @param chan MAVLink channel to send the message
 *
 * @param time_boot_ms [ms] Timestamp (milliseconds since system boot)
 * @param markerID   Decode marker ID. 
 * @param x   Marker pos x. 
 * @param y   Marker pos y. 
 * @param z   Marker pos z. 
 * @param q0   Marker attitude quaternion q0. 
 * @param q1   Marker attitude quaternion q1. 
 * @param q2   Marker attitude quaternion q2. 
 * @param q3   Marker attitude quaternion q3. 
 * @param isTarget   The sign of target. 
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_xap_aruco_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t markerID, float x, float y, float z, float q0, float q1, float q2, float q3, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_XAP_ARUCO_LEN];
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_float(buf, 4, x);
    _mav_put_float(buf, 8, y);
    _mav_put_float(buf, 12, z);
    _mav_put_float(buf, 16, q0);
    _mav_put_float(buf, 20, q1);
    _mav_put_float(buf, 24, q2);
    _mav_put_float(buf, 28, q3);
    _mav_put_uint8_t(buf, 32, markerID);
    _mav_put_uint8_t(buf, 33, isTarget);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_ARUCO, buf, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
#else
    mavlink_xap_aruco_t packet;
    packet.time_boot_ms = time_boot_ms;
    packet.x = x;
    packet.y = y;
    packet.z = z;
    packet.q0 = q0;
    packet.q1 = q1;
    packet.q2 = q2;
    packet.q3 = q3;
    packet.markerID = markerID;
    packet.isTarget = isTarget;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_ARUCO, (const char *)&packet, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
#endif
}

/**
 * @brief Send a xap_aruco message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_xap_aruco_send_struct(mavlink_channel_t chan, const mavlink_xap_aruco_t* xap_aruco)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_xap_aruco_send(chan, xap_aruco->time_boot_ms, xap_aruco->markerID, xap_aruco->x, xap_aruco->y, xap_aruco->z, xap_aruco->q0, xap_aruco->q1, xap_aruco->q2, xap_aruco->q3, xap_aruco->isTarget);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_ARUCO, (const char *)xap_aruco, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
#endif
}

#if MAVLINK_MSG_ID_XAP_ARUCO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_xap_aruco_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, uint8_t markerID, float x, float y, float z, float q0, float q1, float q2, float q3, uint8_t isTarget)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_uint32_t(buf, 0, time_boot_ms);
    _mav_put_float(buf, 4, x);
    _mav_put_float(buf, 8, y);
    _mav_put_float(buf, 12, z);
    _mav_put_float(buf, 16, q0);
    _mav_put_float(buf, 20, q1);
    _mav_put_float(buf, 24, q2);
    _mav_put_float(buf, 28, q3);
    _mav_put_uint8_t(buf, 32, markerID);
    _mav_put_uint8_t(buf, 33, isTarget);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_ARUCO, buf, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
#else
    mavlink_xap_aruco_t *packet = (mavlink_xap_aruco_t *)msgbuf;
    packet->time_boot_ms = time_boot_ms;
    packet->x = x;
    packet->y = y;
    packet->z = z;
    packet->q0 = q0;
    packet->q1 = q1;
    packet->q2 = q2;
    packet->q3 = q3;
    packet->markerID = markerID;
    packet->isTarget = isTarget;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XAP_ARUCO, (const char *)packet, MAVLINK_MSG_ID_XAP_ARUCO_MIN_LEN, MAVLINK_MSG_ID_XAP_ARUCO_LEN, MAVLINK_MSG_ID_XAP_ARUCO_CRC);
#endif
}
#endif

#endif

// MESSAGE XAP_ARUCO UNPACKING


/**
 * @brief Get field time_boot_ms from xap_aruco message
 *
 * @return [ms] Timestamp (milliseconds since system boot)
 */
static inline uint32_t mavlink_msg_xap_aruco_get_time_boot_ms(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field markerID from xap_aruco message
 *
 * @return   Decode marker ID. 
 */
static inline uint8_t mavlink_msg_xap_aruco_get_markerID(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  32);
}

/**
 * @brief Get field x from xap_aruco message
 *
 * @return   Marker pos x. 
 */
static inline float mavlink_msg_xap_aruco_get_x(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field y from xap_aruco message
 *
 * @return   Marker pos y. 
 */
static inline float mavlink_msg_xap_aruco_get_y(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field z from xap_aruco message
 *
 * @return   Marker pos z. 
 */
static inline float mavlink_msg_xap_aruco_get_z(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field q0 from xap_aruco message
 *
 * @return   Marker attitude quaternion q0. 
 */
static inline float mavlink_msg_xap_aruco_get_q0(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field q1 from xap_aruco message
 *
 * @return   Marker attitude quaternion q1. 
 */
static inline float mavlink_msg_xap_aruco_get_q1(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field q2 from xap_aruco message
 *
 * @return   Marker attitude quaternion q2. 
 */
static inline float mavlink_msg_xap_aruco_get_q2(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Get field q3 from xap_aruco message
 *
 * @return   Marker attitude quaternion q3. 
 */
static inline float mavlink_msg_xap_aruco_get_q3(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  28);
}

/**
 * @brief Get field isTarget from xap_aruco message
 *
 * @return   The sign of target. 
 */
static inline uint8_t mavlink_msg_xap_aruco_get_isTarget(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  33);
}

/**
 * @brief Decode a xap_aruco message into a struct
 *
 * @param msg The message to decode
 * @param xap_aruco C-struct to decode the message contents into
 */
static inline void mavlink_msg_xap_aruco_decode(const mavlink_message_t* msg, mavlink_xap_aruco_t* xap_aruco)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    xap_aruco->time_boot_ms = mavlink_msg_xap_aruco_get_time_boot_ms(msg);
    xap_aruco->x = mavlink_msg_xap_aruco_get_x(msg);
    xap_aruco->y = mavlink_msg_xap_aruco_get_y(msg);
    xap_aruco->z = mavlink_msg_xap_aruco_get_z(msg);
    xap_aruco->q0 = mavlink_msg_xap_aruco_get_q0(msg);
    xap_aruco->q1 = mavlink_msg_xap_aruco_get_q1(msg);
    xap_aruco->q2 = mavlink_msg_xap_aruco_get_q2(msg);
    xap_aruco->q3 = mavlink_msg_xap_aruco_get_q3(msg);
    xap_aruco->markerID = mavlink_msg_xap_aruco_get_markerID(msg);
    xap_aruco->isTarget = mavlink_msg_xap_aruco_get_isTarget(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_XAP_ARUCO_LEN? msg->len : MAVLINK_MSG_ID_XAP_ARUCO_LEN;
        memset(xap_aruco, 0, MAVLINK_MSG_ID_XAP_ARUCO_LEN);
    memcpy(xap_aruco, _MAV_PAYLOAD(msg), len);
#endif
}
